import matplotlib.pyplot as plt
import numpy as np
import sys
"""
# def get_beans(counts):
size_array = np.random.rand(20)
poisonousness_array = size_array * 1.2 + np.random.rand(1)


plt.title('draw')
plt.xlabel('x')
plt.ylabel('y')

size_relation_poisonousness = 2

plt.scatter(size_array, poisonousness_array)
predict_poisonousness_array = size_array * size_relation_poisonousness

index = 0
run = True
plt.ion()
while run:
    for element in size_array:
        predict_element_poisonnousness = element * size_relation_poisonousness
        print(predict_element_poisonnousness)
        predict_difference = poisonousness_array[index] - predict_element_poisonnousness
        print(predict_difference)
        index += 1
        if predict_difference > 0:
            size_relation_poisonousness += 0.001
        else:
            size_relation_poisonousness -= 0.001
        if predict_difference ** 2 < 0.0001:
            run = False

    predict_poisonousness_array = size_array * size_relation_poisonousness
    plt.plot(size_array, poisonousness_array)
    plt.plot(size_array, predict_poisonousness_array)
    plt.pause(0.4)
    index = 0

plt.show()

predict_poisonousness_array = size_array * size_relation_poisonousness

plt.plot(size_array, poisonousness_array)
plt.plot(size_array, predict_poisonousness_array)
plt.show()

# y_predict = x_array *
"""

